Skip to content

Preserve JSON-RPC error details in string formatting - #65500

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/jsonrpc-error-data
Open

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/jsonrpc-error-data

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This code was accidentally flipped around.

Successful data marshaling was treated as a failure, dropping useful
details while unsupported values rendered an empty byte slice.

Include successfully encoded details as JSON text and retain the basic
code/message form when data is absent or cannot be marshaled. Cover the
formatting and Error delegation in the existing protocol tests.
Copilot AI balanced review requested due to automatic review settings November 14, 2026 04:20
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 14, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the JSON-RPC error-formatting change.

No open issues 🎉

What changed in this PR

Fixes the shared JSON-RPC error formatter so successfully serialized error details appear as readable JSON in error strings.

Changes:

  • Corrects the success check and formats serialized data as text rather than byte values.
  • Adds regression tests for JSON details, nil receivers, nil data, and unmarshalable data through both String() and Error().
File Description
tsc/​internal/​lsp/​lsproto/​jsonrpc_test.go Adds error-formatting regression tests.
tsc/​internal/​jsonrpc/​jsonrpc.go Includes JSON details when serialization succeeds and data is non-nil.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants